import java.util.*;
import java.io.*;

// 蓝桥杯 三国游戏
public class test {
    public static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();
    public static void main(String[] args) throws IOException{
        int n = in.nextInt();
        long[] arrX = new long[n];
        long[] arrY = new long[n];
        long[] arrZ = new long[n];
        long sumX = 0;
        long sumY = 0;
        long sumZ = 0;
        for(int i = 0;i < n;i++){
            int num = in.nextInt();
            arrX[i] += num;
            arrY[i] -= num;
            arrZ[i] -= num;
            sumX += num;sumY -= num;sumZ -= num;
        }
        for(int i = 0;i < n;i++){
            int num = in.nextInt();
            arrX[i] -= num;
            arrY[i] += num;
            arrZ[i] -= num;
            sumX -= num;sumY += num;sumZ -= num;
        }
        for(int i = 0;i < n;i++){
            int num = in.nextInt();
            arrX[i] -= num;
            arrY[i] -= num;
            arrZ[i] += num;
            sumX -= num;sumY -= num;sumZ += num;
        }
        //System.out.println(sumX + " " + sumY + " " + sumZ + " ");
        Arrays.sort(arrX);
        Arrays.sort(arrY);
        Arrays.sort(arrZ);
        //System.out.println(Arrays.toString(arrX));
        //System.out.println(Arrays.toString(arrY));
        //System.out.println(Arrays.toString(arrZ));
        int index = 0;
        // -3 -1  0 1 1 2 4
        // -1 -1  1 2 3 4 5
        // -4 -3 -1 2 2 2 4
        //分别存储对某个阵营不利的事件终止处
        int indexX = n - 1;boolean indexx = false;
        int indexY = n - 1;boolean indeyy = false;
        int indexZ = n - 1;boolean indezz = false;
        for(int i = 0;i < n;i++){
            if(arrX[i] > 0 && !indexx){
                indexX = i - 1;
                indexx = true;
            }
            if(arrY[i] > 0 && !indeyy){
                indexY = i - 1;
                indeyy = true;
            }
            if(arrZ[i] > 0 && !indezz){
                indexZ = i - 1;
                indezz = true;
            }
        }
        //System.out.println("index: " + indexX + " " + indexY + " " + indexZ);
        int sum = 0;
        int sumx = n;int sumy = n;int sumz = n;
        //如果不符合条件,则代表没有有利于该阵营的事件,不可能获胜
        if(indexX >= 0 && indexX < n - 1){
            sumx = n;
            for(int i = 0;i <= indexX && sumX <= 0;i++){
                sumX -= arrX[i];
                //System.out.println(sumX);
                sumx--;
            }
        }
        if(indexY >= 0 && indexY < n - 1){
            sumy = n;
            for(int i = 0;i <= indexY && sumY <= 0;i++){
                sumY -= arrY[i];
                sumy--;
            }
        }
        if(indexZ >= 0 && indexZ < n - 1){
            sumz = n;
            for(int i = 0;i <= indexZ && sumZ <= 0;i++){
                sumZ -= arrZ[i];
                sumz--;
            }
        }
        //System.out.println("sum: " + sumx + " " + sumy + " " + sumz);
        if(sumz == n) sumz = 0;
        if(sumy == n) sumy = 0;
        if(sumx == n) sumx = 0;
        System.out.println(Math.max(Math.max(sumz,sumy),sumx) == 0 ? -1 : Math.max(Math.max(sumz,sumy),sumx));
    }
}
class Read{
    StringTokenizer st = new StringTokenizer("");
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String next() throws IOException{
        while(!st.hasMoreTokens()){
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    int nextInt() throws IOException{
        return Integer.parseInt(next());
    }
    long nextLong() throws IOException{
        return Long.parseLong(next());
    }
    double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }
}